import CryptoJS from 'crypto-js'

const secretKey = 'c729635fd666cfc1';

/**
 * 加密
 * @param { String } str
 */
export function encrypt(str) {
	const ciphertext = CryptoJS.AES.encrypt(str, secretKey).toString();
	return ciphertext
}

/**
 * 解密
 * @param { String } str
 */
export function decrypt(str) {
	const bytes  = CryptoJS.AES.decrypt(str, secretKey);
	const originalText = bytes.toString(CryptoJS.enc.Utf8);
	return originalText;
}